#include "Polynomial.h"

int main(int argc, char* agrv[]){
  Polynomial<double> p1;
  double d[4] = {3,2.5,-2,1};
  vector<double> v(d,d+4);
  p1.setCoe(v);
  Polynomial<double> p2(v);
  vector<double> v1 = p1.getCoe();
  cout << "Test for input:" << endl;
  cout << v1[0] << "," << v1[1] << "," << v1[2] << "," << v1[3] << endl;
  cout << "Test for degree:" << endl;
  cout << "degree: " << p1.getDegree() << endl;
  cout << "Test for << operator:" << endl;
  cout << "p1: " << p1 << endl;
  double d2[5] = {-3.4,0,6,0,-1};
  vector<double> v2(d2,d2+5);
  p2.setCoe(v2);
  cout << "p2: " << p2 << endl;
  double d3[1] = {2.3};
  vector<double> v3(d3,d3+1);
  Polynomial<double> p3(v3);
  cout << "p3: " << p3 << endl;
  Polynomial<double> p4;
  Polynomial<double> p5;
  double d5[4] = {-3,6,0,-1};
  vector<double> v5(d5,d5+4);
  p5.setCoe(v5);
  cout << "p4: " << p4 << endl;
  cout << "p5: " << p5 << endl;
  cout << "Test for take values:" << endl;
  cout << "For p1, x = 2: p(x) = " << p1.getValue(2) << " ,"
       << "x = -1: p(x) = " << p1.getValue(-1) << endl;
  cout << "For p2, x = 2: p(x) = " << p2.getValue(2) << " ,"
       << "x = 0: p(x) = " << p2.getValue(0) << endl;
  cout << "Test for Derivation:" << endl;
  cout << "dp1: " << p1.getDerivation() << endl;
  cout << "dp2: " << p2.getDerivation() << endl;
  cout << "dp3: " << p3.getDerivation() << endl;
  cout << "dp4: " << p4.getDerivation() << endl;
  cout << "dp5: " << p5.getDerivation() << endl;
  cout << "Test for + :" << endl;
  cout << "p1 + p2 : " << (p1 + p2) << endl;
  cout << "p1 + p3 : " << (p1 + p3) << endl;
  cout << "p2 + p4 : " << (p2 + p4) << endl;
  cout << "p1 + p5 : " << (p1 + p5) << endl;
  cout << "Test for - :" << endl;
  cout << "p2 - p1 : " << (p2 - p1) << endl;
  cout << "p1 - p3 : " << (p1 - p3) << endl;
  cout << "p3 - p4 : " << (p3 - p4) << endl;
  cout << "Test for * :" << endl;
  cout << "p2 * p1 : " << (p2 * p1) << endl;
  cout << "p1 * p3 : " << (p1 * p3) << endl;
  cout << "p2 * p4 : " << (p2 * p4) << endl;
  cout << "p3 * p4 : " << (p3 * p4) << endl;
  cout << "3.0 * p1 :" << (3.0 * p1) << endl;
  cout << "2.5 * p3 :" << (2.5 * p3) << endl;
  
    
}
